$(function(){
    $("form").submit(function(){
        var self = $(this);
        $.post(self.attr("action"), self.serialize(), success, "json");
        return false;
        function success(data){
            if(data.code){
                $.messager.show(data.msg, {placement: 'center',type:'success'});
                setTimeout(function(){
                    window.location.href = data.url;
                },2000);
            } else {
                $.messager.show(data.msg, {placement: 'center',type:'success'});
            }
        }
    });
})
